/************** init.html **************/
function queryClasses_classes(page) {
	var parm = $('#queryClassesForm').serialize() + sys_get_page(page);
	var url = create_url('classes-query');
	sys_query_parm = parm;
	sys_loading();
	$.ajax({type:'POST', url:url, data:parm,
		success: function(result) {
			sys_loading_close();
			$('#resultList').html(result);
		}
	});
}
//报名管理
function signClasses_classes(code){
	var url = create_url("classes-classSignInit");
	var parm = {"code":code};
	$.colorbox({overlayClose:false, href:url, data:parm, close:'[关闭]', width:'900px', height:'600px', open:true});
}

function shield_classes(code,name){
	$.Zebra_Dialog('确认屏蔽班级'+ name + " 吗？",{
		'type': 'question','title': '警告' ,'buttons':[
           {caption:'屏蔽',callback:function() {
				var parm = {'code':code};
				var url = create_url('classes-shield');
	        	$.ajax({type:'POST', url:url, data:parm,
					success: function(result) {
						if(result == 'success'){
							sys_msg("操作成功!");
						}else{
							sys_msg("操作失败，请刷新后重试!");
						}
					}
				});
    		}},
           {caption:'取消',callback:function(){}
    	}]
	});
}


function unshield_classes(code, name){
	$.Zebra_Dialog('确认解除班级'+ name + " 吗？",{
		'type': 'question','title': '警告' ,'buttons':[
           {caption:'屏蔽',callback:function() {
				var parm = {'code':code};
				var url = create_url('classes-unshield');
	        	$.ajax({type:'POST', url:url, data:parm,
					success: function(result) {
						if(result == 'success'){
							sys_msg("操作成功!");
						}else{
							sys_msg("操作失败，请刷新后重试!");
						}
					}
				});
    		}},
        {caption:'取消',callback:function(){}
    	}]
	});
}

/*********************edit.html******************************/
/**
 * 验证保存信息
 */
function checkClassesInfo(){
 	var name = $("#name").val();
 	var howClass = $("#howClass").val();
 	var courseTbody = $("#courseTbody");
 	var studentsUl = $("#student");
 	var topicEd = $("#topicEd");
 	if(name.length == 0 || name == ""){
 		sys_msg('请填写班级名称');
 		$("#name").focus();
 		return;
 	}
 	if(howClass.length ==0 || howClass == ""){
 		sys_msg("请选择报名方式");
 		return;
 	}
 
   	if(courseTbody.find("tr").length == 0){
   		 sys_msg("至少添加一门课程！");
         return;
   	}
   	if(howClass == "3"){
  	 	if(studentsUl.find(".rep").length == 0){
  	 		 sys_msg("因为报名方式为自选 ，至少选择一已个学生");
  	 		 return;
  	 	}
   	}
   	var flag = false;
   	courseTbody.find("tr").each(function(){
   		var cc = $(this).find("td:eq(0) > select:eq(0)").val();
   		if(cc.length == 0 || cc == ""){
   			flag = true;
   			return false;
   		}
   	})
   	if(flag){
   		sys_msg("请选择 添加的课程！");
   		return;
   	}
   	
   	var flag1 = false;
   	courseTbody.find("tr").each(function(){
   		var ttc = $(this).find("td:eq(2) > select:eq(0)").val();
   		if(ttc.length == 0 || ttc == ""){
   			var cc = $(this).find("td:eq(0) > select:eq(0)").val();
   			var len = $("#topicEd").find(".cc_" + cc).length;
   			if(len == 0){
   				flag1 = true;
   				return false;
   			}
   		}
   	})
   	if(flag1){
   		sys_msg("请为自选的课程 选择题目!");
   		return;
   	}
   
   	saveClasses_classes();
}
/**
 * 保存信息
 */
function saveClasses_classes(){
	var parm = $('#editClassesForm').serialize();
	var url = create_url('classes-save');
	sys_submiting();
	$.ajax({type:'POST', url:url, data:parm,
		success: function(result) {
			sys_submiting_close();
			if (result == 'success') {
				sys_msg('操作成功');
				sys_load_handle('classes');
			} else {
				sys_msg('操作失败，请刷新后重试');
			}
		}
	});
}
/**
 * 选择课程
 *//*
function chooseCourseClass_classes(){
	var codes = $("#codes2").val();
	var url = create_url("classes-aidInit");
	var parm = {"codes":codes};
	$.colorbox({overlayClose:false, href:url, data:parm, close:'[关闭]', width:'850px', height:'600px', open:true});
}*/

/**
 * 选择学生
 */
function chooseUserClass_classes(){
	var codes = $("#codes4").val();
	var url = create_url("classes-aidInit1");
	var parm = {"codes":codes};
	$.colorbox({overlayClose:false, href:url, data:parm, close:'[关闭]', width:'850px', height:'600px', open:true});
}

/**
 * 删除已选中的课程
 */
function deleteCourseClass_classes(btn){
	btn.parent().parent().remove();
	/*var leng = $("#courseTbody tr").length;
	if(leng == 0 ){
		$("#courseTableDiv").hide();
	}*/
}


/**
 * 报名方式onchange
 */
function onchangeHowClasses_classes(){
	var how = $("#howClass").val();
	if(how == "3"){
		$("#studentsDiv").show();
	}else{
		$("#studentsUl li").remove();
		$("#studentsDiv").hide();
	}
}

/**
 * 删除已选学生
 */
function deleteChoiseClass_classes(btn){
	btn.parent().parent().parent().remove();
	setStudentsCodes_classes();
}

/**
 * 设置已选中学生CODE
 */
function setStudentsCodes_classes(){
	var codes = "";
	$(".ucCode").each(function(){
		codes = $(this).val() + "," + codes;
	});
	$("#codes4").val(codes);
}




/**
 * 验证是否有相同课程
 */
function onchangeCourse_classes(btn,i){
	var code = btn.val();
	var index = 0;
	$("#courseTbody").find("tr").each(function(){
		var course = $(this).find("td:eq(0) > select:eq(0)").val();
		if(course == code){
			index ++;
		}
	});
	if(index >= 2){
		sys_msg("不能选择相同的课程！");
		btn.get(0).selectedIndex = 0;
	}
	/*var parm = {'cc':code};
	var url = create_url('classes-queryCc');
	$.ajax({type:'POST', url:url, data:parm,
		success: function(result) {
			$("#tc_" + i).children().remove();
			$("#tc_" + i).append(result);
		}
	});*/
	queryTc_classes(i);
}
/**
 * 获取讲师信息
 */
function queryTc_classes(i){
	var cc = $("#cc_" + i).val();
	/*if(cc == null || cc == ""){
		sys_msg("还没有选择课程哦！");
		return;
	}*/
	var parm = {'cc':cc};
	var url = create_url('classes-queryTc');
	sys_submiting();
	$.ajax({type:'POST', url:url, data:parm,
		success: function(result) {
			$("#tc_" + i).children().remove();
			$("#tc_" + i).append(result);
		}
	});
}

/**
 * 添加新课程
 */
function addNewCourse_classes(){
	var index = parseInt($("#index").val());
	var newTr = $("#courseTable").find("tr").clone(true);
		newTr.find(".cc").attr({"id":"cc_" + index,"name": "ccrList[" + index + "].cc"}).end()
			.find(".tc").attr({"id":"tc_" + index ,"name": "ccrList[" + index + "].tc"}).end()
			.find(".ttc").attr({"name": "ccrList[" + index + "].ttc","i":index,"id":"select_" + index}).end()
			.find(".btn").attr({"i":index}).end()
			.find("td:eq(4) > input:eq(0)").attr("name","ccrList[" + index + "].examTime").end()
			.find("td:eq(5) > input:eq(0)").attr("name","ccrList[" + index + "].time").end()
			.find(".examNum").attr("name","ccrList[" + index + "].num").end()
			.find(".zf").attr("id","sore_" + index ).end()
			.find(".qualifiedSocre").attr("name","ccrList[" + index + "].qualifiedSocre").end()
			.find(".type").attr({"name":"ccrList[" + index + "].type"});
		$("#courseTbody").append(newTr);
		index++;
		$("#index").val(index);
	$("#courseTableDiv").show();
}
/******************************课程AIDLIST.HTML***********************************/
/**
 * 完成课程确认
 */
function  confirmCourse_classes(){
	$("#courseTbody tr").each(function(){
		$(this).remove();
	});
	var index = parseInt($("#index").val());
	$("#addTbody2 tr").each(function(){
		var name = $(this).find(".cName").val();
		var code = $(this).find(".cCode").val();
		var newTr = $("#courseTable").find("tr").clone(true);
		newTr.find("td:eq(0)").text(name).end()
			.find(".ccCode").val(code).attr("name", "ccrList[" + index + "].cc").end()
			.find(".ttc").attr({"name":"ccrList[" + index + "].ttc"}).end()
			.find("td:eq(2) > input:eq(0)").attr("name","ccrList[" + index + "].examTime").end()
			.find("td:eq(3) > input:eq(0)").attr("name","ccrList[" + index + "].startExamTime").end()
			.find("td:eq(4) > input:eq(0)").attr("name","ccrList[" + index + "].endExamTime").end()
			.find(".examNum").attr("name","ccrList[" + index + "].examNum").end()
			.find(".qualifiedSocre").attr("name","ccrList[" + index + "].qualifiedSocre");
		$("#courseTbody").append(newTr);
		index = index + 1;
		$("#index").val(index);
	});
	//把CODES值附到 EIDT上面
	var codes = "";
	$(".cCode").each(function(){
		if($(this).val().length != 0 || $(this).val() != ""){
			codes = $(this).val() + ","+ codes  ;
		}
	});
	$("#codes2").val(codes);
	var leng = $("#addTbody2 tr").length;
	if(leng == 0){
		$("#courseTableDiv").hide();
	}else{
		$("#courseTableDiv").show();
	}
	$.fn.colorbox.close();
}
/*********************useraidInit.html***************************/
/**
 * 查询学生
 */
function aidqueryUserClass_classes(page) {
	var parm = $('#queryUserForm').serialize() + sys_get_page(page);
	var url = create_url('classes-aidList1');
	sys_loading();
	$.ajax({type:'POST', url:url, data:parm,
		success: function(result) {
			sys_loading_close();
			$('#userResultList').html(result);
		}
	});
}
/******************************aiduserList.html*********************************************/
/**
 * 确认选中学生 放数据 放入EIDT页面
 */
function confirmUser_classes(){
	$("#student div").remove();
	var index = parseInt($("#stIndex").val()); 
	$("#addTbody3").find("tr").each(function(){
		var name = $(this).find(".stuName").val();
		var code = $(this).find(".stuCode").val();
		var newLi = $("#stAddDiv").find(".rep").clone(true);
			newLi.find(".ucName").val(name).end()
				 .find(".yy").html(name).end()
				 .find(".ucCode").attr("name","ucrList[" + index + "].uc").end()
				 .find(".ucCode").val(code);
		index = index + 1;
		$("#stIndex").val(index);
		$("#student").append(newLi);
	});
	var codes = "";
	$(".stuCode").each(function(){
		if($(this).val().length != 0 || $(this).val() != ""){
			codes = $(this).val() + ","+ codes  ;
			
		}
	});
	$("#codes4").val(codes);
	$.fn.colorbox.close();
}
/**
 * 选择学生
 */
function choiseUser_classes(btn,code,name){
	btn.parent().parent().remove();
	var newTr = $("#stTable").find(".tr2").clone(true);
		newTr.find("td:eq(0)").text(name).end()
		.find(".stuName").val(name).end()
		.find(".stuCode").val(code);
	$("#addTbody3").append(newTr);
	aidSetUserCodes_classes();
}
/**
 * 删除选中学生
 */
function deleteChoiseUser_classes(btn){
	btn.parent().parent().remove();
	aidSetUserCodes_classes();
	aidqueryUserClass_classes();
}
/**
 * 设置学生CODE在INIT页面上 
 */
function aidSetUserCodes_classes(){
	var codes = "";
	$(".stuCode").each(function(){
		if($(this).val().length != 0){
			codes = $(this).val() + "," + codes ;
		}
	})
	$("#codes3").val(codes);
	aidqueryUserClass_classes();
}

/**
 * 选择题目
 */
function choiseTopicAll_classes(btn){
	var ttc = btn.parent().parent().find(".ttc").val(); 	// 模板编号
	var cc = btn.parent().parent().find(".cc").val();		// 课程编号	
	var k = btn.attr("i");
	if(cc.length == 0 || cc == ""){
		sys_msg('请选择课程 才能添加题目！');k
		return;
	}
	var url ="";
	var parm = "";
	if(ttc.length == 0 || ttc == ""){
		 url = create_url("classes-aidInit");
		 parm = {"cc":cc,'k':k};
	} else {
		 url = create_url("classes-aidInit2");
		 parm = {"ttc":ttc,"cc":cc};
	}
	$.colorbox({overlayClose:false, href:url, data:parm, close:'[关闭]', width:'1200px', height:'700px', open:true});
}

/*****************************有模板的init.html**************************************/
/**
 * 有模板的情况下查询题目
 */
function aidqueryTopicClasses_classes(page) {
	var parm = $('#aidQueryTopicForm').serialize() + sys_get_page(page);
	var url = create_url('classes-aidList2');
	sys_loading();
	$.ajax({type:'POST', url:url, data:parm,
		success: function(result) {
			sys_loading_close();
			$('#mubanCodeDiv').html(result);
			showCheckedCheckBox();
		}
	});
}

/**
 * 模板有值的情况下选择题目
 */
function choiseTopicHasCode_classes(btn,type,lc,tic,page,point,num){
	$("#tic").val(tic);
	$("#points").val(point);
	$("#numTopic").val(num);
	$("#typeTopic").val(type);
	$("#topicType option").each(function(){
		if($(this).val() == type){
			$(this).attr("selected",true);
			return false;
		}
	});
	$("#topicLevel option").each(function(){
		if($(this).val() == lc){
			$(this).attr("selected",true);
			return false;
		}
	});
	var parm = $('#aidQueryTopicForm').serialize() + sys_get_page(page);
	var url = create_url('classes-aidList2');
	sys_loading();
	$.ajax({type:'POST', url:url, data:parm,
		success: function(result) {
			sys_loading_close();
			$('#mubanCodeDiv').html(result);
			showCheckedCheckBox();
		}
	});
}
/**
 * 选择题目
 */
function choiseTopicHasTcClasses_classes(btn){
	var tic = $("#tic").val();
	var cc = $("#courseCode").val();
	var tc = btn.val();
	var points = $("#points").val();
	var numTopic = $("#numTopic").val();
	var typeTopic = $("#typeTopic").val();
	
	if(btn.attr("checked") == "checked"){
		var newTr = $("#addTopicTable").find("tr").clone(true);
			newTr.find("td:eq(0) > input:eq(0)").val(tic).end()
			.find("td:eq(1) > input:eq(0)").val(cc).end()
			.find("td:eq(2) > input:eq(0)").val(tc).end()
			.find("td:eq(3) > input:eq(0)").val(points).end()
			.find("td:eq(6) > input:eq(0)").val(typeTopic).end()
			.attr("id","tc_"+ tc).end();
		$("#topicTable").append(newTr);
	}else{
		$("#tc_"+tc).remove();
	}
	//判断题目数是否超过模板规定数量
	var temp = 0;
	$("#topicTable").find("tr").each(function(){
		var type = $(this).find("td:eq(6) > input:eq(0)").val();
		if(type == typeTopic){
			temp++;
		}
	})
	if(temp > numTopic){
		sys_msg("只能选择" + numTopic + "道题");
		btn.attr("checked",false);
		$("#tc_"+tc).remove();
		return 
	}
	calcTotalHasTcOrNotTc_classes();
}
/**
 * 弹出层弹出时 把已选择的 勾选上
 */
function showCheckedCheckBox(){
	$("#topicTable").find("tr").each(function(){
		var oldTc = $(this).find(".tc").val();
		$("#addTbody5").find("input:checkbox").each(function(){
			var newTc = $(this).val();
			if(oldTc == newTc){
				$(this).attr("checked",true);
			}
		});
	});
}
/**
 * 点击确认 把选中的题目复制到 EIDT页面上
 */
function confirmTopic_classes(){
	var cc = $("#courseCode").val();
	//先删除 该课程的所有tr
	$("#topicEd").find(".cc_" + cc).each(function(){
		$(this).remove();
	});
	//添加现在的新tr
	var index = parseInt($("#topicIndex").val());
	$("#topicTable").find("tr").each(function(){
		var tic = $(this).find("td:eq(0) > input:eq(0)").val();
		var tc = $(this).find("td:eq(2) > input:eq(0)").val();
		var points = $(this).find("td:eq(3) > input:eq(0)").val();
		var type = $(this).find("td:eq(6) > input:eq(0)").val();
			var newTr = $("#addTopicTable").find("tr").clone(true);
			newTr.find("td:eq(0) > input:eq(0)").val(tic).attr("name","cctrList[" + index + "].tic").end()
			.find("td:eq(1) > input:eq(0)").val(cc).attr("name","cctrList[" + index + "].cc").end()
			.find("td:eq(2) > input:eq(0)").val(tc).attr("name","cctrList[" + index + "].tc").end()
			.find("td:eq(3) > input:eq(0)").val(points).attr("name","cctrList[" + index + "].points").end()
			.find("td:eq(6) > input:eq(0)").val(type).end()
			.addClass("cc_"+cc).end();
		$("#topicEd").append(newTr);
		index++;
		$("#topicIndex").val(index);
	});
	sys_msg("选题成功！");
	$.fn.colorbox.close();
}

/**
 * 打开弹出层时 提取 页面上的信息
 */
function getEditTopicInfo_classes(){
 	var cc = $("#courseCode").val();
 	$("#topicEd").find(".cc_" + cc).each(function(){
 		var tic = $(this).find("td:eq(0) > input:eq(0)").val();
		var tc = $(this).find("td:eq(2) > input:eq(0)").val();
		var points = $(this).find("td:eq(3) > input:eq(0)").val();
		var type = $(this).find("td:eq(6) > input:eq(0)").val();
		var newTr = $("#addTopicTable").find("tr").clone(true);
			newTr.find("td:eq(0) > input:eq(0)").val(tic).end()
			.find("td:eq(1) > input:eq(0)").val(cc).end()
			.find("td:eq(2) > input:eq(0)").val(tc).end()
			.find("td:eq(3) > input:eq(0)").val(points).end()
			.find("td:eq(6) > input:eq(0)").val(type).end()
			.attr("id","tc_"+ tc).end()
			$("#topicTable").append(newTr);
 	});
}
/*****************************无模板板的init.html**************************************/

function aidqueryTopic1_classes(page){
	var parm = $('#aidQueryTopicForm1').serialize() + sys_get_page(page);
	var url = create_url('classes-aidList');
	sys_loading();
	$.ajax({type:'POST', url:url, data:parm,
		success: function(result) {
			sys_loading_close();
			$('#topicResultList').html(result);
			showCheckedCheckBoxHasNotTc();
			
		}
	});
}
function choiseTopicHasNotTcClasses_classes(btn){
	var cc = $("#courseCode1").val();
	var tc = btn.val();
	var points = btn.parent().parent().parent().parent().find("td:eq(3) > input:eq(0)").val();
	if(points == "" || points.length == 0){
		sys_msg('请填写分数！才能选择');
		btn.removeAttr("checked");
		return
	}
	if(btn.attr("checked") == "checked"){
		var newTr = $("#addTopicTable").find("tr").clone(true);
			newTr.find("td:eq(1) > input:eq(0)").val(cc).end()
			.find("td:eq(2) > input:eq(0)").val(tc).end()
			.find("td:eq(3) > input:eq(0)").val(points).end()
			.attr("id","tc_"+ tc).end();
		$("#topicTable").append(newTr);
	}else{
		$("#tc_"+tc).remove();
	}
	calcTotalHasTcOrNotTc_classes();
}


function calcTotalHasTcOrNotTc_classes(){
	var total = 0;
	var dx = 0;
	var dx1 = 0;
	var jd = 0;
	
	$("#addTbody").find(".dx").each(function(){
		var type = $(this).val();
		if(type != "" && type.length != 0){
			dx = dx + parseFloat(type);
		}
	});
	$("#addTbody").find(".dx1").each(function(){
		var type = $(this).val();
		if(type != "" && type.length != 0){
			dx1 = dx1 + parseFloat(type);
		}
	});
	$("#addTbody").find(".jd").each(function(){
		var type = $(this).val();
		if(type != "" && type.length != 0){
			jd = jd + parseFloat(type);
		}
	});
	total = dx + dx1 + jd;
	$("#showTopicTotal").html("当前选题总分:" + total + "分,单选题："+ dx + "分，多选题："+ dx1 + "分，简答题："+ jd +"分");
	$("#total1").val(total);
}

function showCheckedCheckBoxHasNotTc(){
	$("#topicTable").find("tr").each(function(){
		var oldTc = $(this).find(".tc").val();
		var points = $(this).find(".points").val();
		$("#addTbody6").find("input:checkbox").each(function(){
			var newTc = $(this).val();
			if(oldTc == newTc){
				$(this).attr("checked",true);
				if(points.length != 0){
					$(this).parent().parent().parent().parent().find("td:eq(3) > input:eq(0)").val(points);
				}
			}
		});
	});
}
function confirmTopicHasNotTc_classes(){
	var cc = $("#courseCode1").val();
	var k = $("#k").val();
	var total = $("#total1").val();
	//先删除 该课程的所有tr
	$("#topicEd").find(".cc_" + cc).each(function(){
		$(this).remove();
	});
	//添加现在的新tr
	var index = parseInt($("#topicIndex").val());
	$("#addTbody").find("tr").each(function(){
		var tc = $(this).find(".tc").val();
		var points = $(this).find("#point").val();
		var newTr = $("#addTopicTable").find("tr").clone(true);
		newTr.find(".tc").val(tc).attr("name","cctrList[" + index + "].tc").end()
			.find(".points").val(points).attr("name","cctrList[" + index + "].points").end()
			.find(".cc").val(cc).attr("name","cctrList[" + index + "].cc").end()
			.addClass("cc_" + cc).end();
		$("#topicEd").append(newTr);
		index++;
		$("#topicIndex").val(index);
	});
	if (k != '' && k != undefined){
		$("#sore_" + k).html(total);
	}
	sys_msg("选题成功！");
	$.fn.colorbox.close();
}

function choiseTopic_classes(obj, code, content,type,tdc,tdn,point){
	/*$("#addTbody").find("tr.tc").each(function(){
		var tc = $(this).val();
		if(tc != "" && tc == code){
			sys_msg("这个题目已经选过了！")
			return;
		}
	});*/
	if(content.length >= 15) {
		content = content.substring(0,15) + '...';
	}
	var a='';
	var b='';
	if (type == 1){
		a ="单选题";
		b ='dx';
	}else if(type == 2){
		a ="多选题";
		b ='dx1';
	}else{
		a ="简答题";
		b ='jd';
	}
	var row = $("#tjTable").find("tr.footable-even").clone(true);
	row.find(".t").html(content).end()
		.find(".tc").attr({'value':code}).end()
		.find(".a").html(a).end()
		.find(".type").attr({'value':type}).end()
		.find(".tdn").html(tdn).end()
		.find(".tdc").attr({'value':tdc}).end()
		.find("#point").attr({'value':point,'class':b}).end()
		.find(".cc").attr({"value":code});
	$("#addTbody").append(row);
	obj.parents("tr.footable-even").remove();
	calcTotalHasTcOrNotTc_classes();
}
function deleteChoiseTopic_classes(obj){
	obj.parents("tr.footable-even").remove();
	calcTotalHasTcOrNotTc_classes();
	/*querycodes_course();
	queryCourse_course();*/
}
/**
 * 打开弹出层时 提取 页面上的信息
 */
function getEditTopicInfoHasNotTc_classes(){
 	var cc = $("#courseCode1").val();
 	$("#topicEd").find(".cc_" + cc).each(function(){
 		var tc = $(this).find("td:eq(2) > input:eq(0)").val();
		var points = $(this).find("td:eq(3) > input:eq(0)").val();
		var newTr = $("#addTopicTable").find("tr").clone(true);
			newTr.find("td:eq(1) > input:eq(0)").val(cc).end()
			.find("td:eq(2) > input:eq(0)").val(tc).end()
			.find("td:eq(3) > input:eq(0)").val(points).end()
			.attr("id","tc_"+ tc).end();
			$("#topicTable").append(newTr);
 	});
}

function blurAddNewPoints(btn,tc){
	var points = btn.val();
	if(points.length == 0 || points  == ""){
		sys_msg("请输入分值！");
		btn.focus();
		return
	}
	$("#tc_" + tc).find(".points").val(points);
}

/***************************报名页面.init.html***********************************/

function querySignClass_classes(page) {
	var parm = $('#querySignForm').serialize() + sys_get_page(page);
	var url = create_url('classes-classSignList');
	sys_loading();
	$.ajax({type:'POST', url:url, data:parm,
		success: function(result) {
			sys_loading_close();
			$('#signResultList').html(result);
		}
	});
}

function choiseSignStudents1(btn, uc, name){
	var code = $("#code").val();
	var url ="";
	if(btn.attr("checked") == "checked"){
       	url = create_url('classes-pass');
       	aidExecuteStudentSign(code, uc, url);
    }else{
       	url = create_url('classes-unpass');
       	aidExecuteStudentSign(code, uc, url);
        btn.attr("checked",false);
    }
}

function aidExecuteStudentSign(code,uc, url){
	var parm = {"code":code,"uc":uc};
	sys_submiting();
	$.ajax({type:'POST', url:url, data:parm,
		success: function(result) {
			sys_submiting_close();
			if ('success' == result) {
				querySignClass_classes();
			} else {
				sys_msg("操作失败", "操作失败，请刷新页面再次尝试，如果问题依然存在，请联系管理员!");
			}
		}
	});
}

function allSignSuccess(){
	var code = $("#code").val();
	var parm = {"code":code};
	var url = create_url('classes-allSign');
	sys_submiting();
	$.ajax({type:'POST', url:url, data:parm,
		success: function(result) {
			sys_submiting_close();
			if ('success' == result) {
				sys_msg("操作成功！");
				querySignClass_classes();
			} else {
				sys_msg("操作失败", "操作失败，请刷新页面再次尝试，如果问题依然存在，请联系管理员!");
			}
		}
	});
}
function checkhow_classes(){
	var sore = jQuery("#howClass option:selected").val();
	if(sore == 3){
		$("#num").attr({'readonly':'readonly',"placeholder":"自选的不能限制人数"});
	}else{
		$("#num").removeAttr('readonly');
		$("#num").removeAttr("placeholder");
	}
}
function sore_classes(obj){
	var i =obj.attr("i");
	var sore = jQuery("#select_"+ i +"  option:selected").attr("date-sore");
	if(sore == "" || sore == "undefined" || sore == null){
		$("#sore_" + i).html(0);
	}else{
		$("#sore_" + i).html(sore);
	}
	
}